package com.stlm2.dems.dao.impl;

import org.springframework.stereotype.Repository;

import com.stlm2.dems.entity.GoodsOrder;
import com.stlm2.dems.dao.GoodsOrderDao;
import com.stlm2.core.base.impl.BaseDaoImpl;

import java.util.List;

@Repository("goodsOrderDao")
public class GoodsOrderDaoImpl extends BaseDaoImpl<GoodsOrder> implements GoodsOrderDao {

    @Override
    public GoodsOrder getByCode(String code) {
        return selectOne("getByCode",code);
    }

    @Override
    public List<GoodsOrder> getByShopOrderCode(String shopOrderCode) {
        return selectList("getByShopOrderCode",shopOrderCode);
    }

    @Override
    public Integer countByPurchaseOrderCode(String purchaseOrderCode) {
        return (Integer) _selectOne("countByPurchaseOrderCode",purchaseOrderCode);
    }


    @Override
    public Double sumByPurchaseOrderCode(String purchaseOrderCode) {
        return (Double) _selectOne("sumByPurchaseOrderCode",purchaseOrderCode);
    }

    @Override
    public Double sumByShopOrderCode(String shopOrderCode) {
        return (Double) _selectOne("sumByShopOrderCode",shopOrderCode);
    }

    @Override
    public Double sumForCommission(GoodsOrder goodsOrder) {
        return  (Double) _selectOne("sumForCommission",goodsOrder);
    }

    @Override
    public void updateComment(String shopOrderCode) {
        update("updateComment",shopOrderCode);
    }
}